package cn.how2j;
import java.io.File;
import java.util.Iterator;
import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import cn.how2j.db.DBSConn;
import cn.how2j.util.ActiveMQUtil;



@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:spring_jms.xml")
public class TestProducer {
	
	/**
	 * listen 进行监听  producer消息发送到MyMessageList
	 */
    @Autowired
    private Producer producer;
    
    
    @Before
    public void checkServer() {
    	ActiveMQUtil.checkServer();
    }
    
    @Test
    public void testSend(){
    	for (int i = 0; i < 10; i++) {
            producer.sendTextMessage("消息 " + i);
            File file=new File("Person.xlsx");
    		ReadXLSX r=new ReadXLSX();
    		List l=r.getXlsxData(file);
    		Iterator<Person> p=l.iterator();
    		while (p.hasNext()) {
    			System.out.print(p.next().getName());
    		}
    	}
         
    	
		}
   
    
    }
